<form action="<?php echo base_url();?>main/add_post" method="post">
    <script type="text/javascript">
        function add_field_m(object){
            new_obj = $('.input-con').last().clone();
            new_obj.hide();
            new_obj.find('.input').val('');
            new_obj.find('.input-del').removeClass('hidden');
            $(object).parents('.input-con').after(new_obj);
            new_obj.slideDown('slow');
        }
        function remove_field_m(object){
            $(object).parents('.input-con').slideUp('slow',function(){
                $(object).parents('.input-con').remove();
            });
        }
    </script>
    <div id="expenseAdd">
        <div  class="input-header">
            <table class="input-table">
                <tbody>
                    <tr>
                        <td class="input-field">
                            <h2>Title</h2>
                        </td>
                        <td class="input-field">
                            <h2>Amount</h2>
                        </td>
                        <td class="input-field">
                            <h2>Category</h2>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div  class="input-con">
            <table class="input-table">
                <tbody>
                    <tr>
                        <td class="input-field">
                            <input type="text" value="" name="title[]" class="input" />
                        </td>
                        <td class="input-field">
                            <input type="text" pattern="[0-9]*" value="" name="amount[]" class="input" />
                        </td>
                        <td class="input-cat">
                            <select name="category[]">
                                <?php foreach ($cat->result() as $item) : ?>
                                <option value="<?php echo $item->category_id;?>">
                                    <?php echo $item->category_title;?>
                                </option>
                                <?php endforeach; ?>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="input-add">
                            <a href="#" onclick="add_field_m(this)">[+]add more</a>
                            <a href="#" class="input-del hidden" onclick="remove_field_m(this)">[-]delete</a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div id="expenseSubmit">
        <input type="submit" value="Submit" class="btn" id="submit" />
    </div>
</form>